package cn.msi.customer.action;

import cn.common.action.GeneralAction;
import cn.msi.customer.domain.Customer;
import cn.msi.customer.service.CustomerService;

/**
 * 客户资源请求业务处理类
 * 
 * @author Administrator
 * 
 * @param <Customer>
 */
public class CustomerAction extends GeneralAction {

	private static final long serialVersionUID = 6576767003427199989L;

	private Customer customer = new Customer();

	private CustomerService customerService;

	/**
	 * 用户注册请求业务处理
	 * 
	 * @throws Exception
	 */
	public void regist() throws Exception {
		customerService.register(customer);
	}

	/**
	 * 查询客户请求
	 * 
	 * @throws Exception
	 */
	public void searchCustomer() throws Exception {
		page(customer);
		String json = customerService.searchCustResource(customer);
		out(json);
	}

	/**
	 * 查找客户资料信息
	 * 
	 * @return
	 * @throws Exception
	 */
	public String findCustomer() throws Exception {
		customer = customerService.findCustResource(customer);
		return SUCCESS;
	}

	/**
	 * 编辑客户资料信息
	 * 
	 * @throws Exception
	 */
	public void editCustomer() throws Exception {
		customerService.redactCustResource(customer);
	}

	/**
	 * 删除客户资料信息
	 * 
	 * @throws Exception
	 */
	public void deleteCustomer() throws Exception {
		customerService.deleteCustResource(customer);
	}
	
	/**
	 * 查看被调研客户的机构列表
	 * @return
	 * @throws Exception
	 */
	public String searchChkOrg() throws Exception {
		customer = customerService.findCustResource(customer);
		return SUCCESS;
	}
	
	/**
	 * 查看被调研客户的用户账号列表
	 * @return
	 * @throws Exception
	 */
	public String searchUser() throws Exception {
		customer = customerService.findCustResource(customer);
		return SUCCESS;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public CustomerService getCustomerService() {
		return customerService;
	}

	public void setCustomerService(CustomerService customerService) {
		this.customerService = customerService;
	}
}
